package com.zz.ecommerce.togatherDeclareMgr.custDeclarationUpload.dao;


import com.zz.ecommerce.togatherDeclareMgr.common.bean.TCargo;
import com.zz.ecommerce.togatherDeclareMgr.common.bean.TContainers;
import com.zz.ecommerce.togatherDeclareMgr.common.bean.TEntryInfo;
import com.zz.ecommerce.utils.SqlProvider;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by zhangmeng on 2015/9/5.
 */
@Repository
public interface CargoExportCustDao {

    @SelectProvider(type = SqlProvider.class, method = "getSequence10")
    String getSequence10();

    /**
     * 插入海关货物信息
     *
     * @param tableName
     * @param cargo
     * @return
     */
    @InsertProvider(type = SqlProvider.class, method = "insert")
    boolean inserTCargo(@Param("tableName") String tableName,
                        @Param("insertObj") TCargo cargo);

    /**
     * 查询海关货物信息
     *
     * @param tableName
     * @param cargo
     * @param order
     * @return
     */
    @SelectProvider(type = SqlProvider.class, method = "selectOne")
    TContainers queryOneTCargo(@Param("tableName") String tableName,
                               @Param("qryObj") TCargo cargo,
                               @Param("sortOrder") String order);

    /**
     * 修改海关货物信息
     *
     * @param tableName
     * @param cargo
     * @param whereCondition
     * @return
     */
    @InsertProvider(type = SqlProvider.class, method = "update")
    boolean updateTCargo(@Param("tableName") String tableName,
                         @Param("updateObj") TCargo cargo, @Param("updateCondition") String whereCondition);

    /**
     * 插入海关表头
     *
     * @param tableName
     * @param entryInfo
     * @return
     */
    @InsertProvider(type = SqlProvider.class, method = "insert")
    boolean inserTEntryInfo(@Param("tableName") String tableName,
                            @Param("insertObj") TEntryInfo entryInfo);


    /**
     * 修改海关表头
     *
     * @param tableName
     * @param entryInfo
     * @param whereCondition
     * @return
     */
    @InsertProvider(type = SqlProvider.class, method = "update")
    boolean updateTEntryInfo(@Param("tableName") String tableName,
                             @Param("updateObj") TEntryInfo entryInfo, @Param("updateCondition") String whereCondition);

    /**
     * 删除海关表头
     *
     * @param indx
     * @return
     */
    @Delete("delete from t_EntryInfo where INDX=#{indx}")
    boolean deleteEntryInfo(String indx);



    /*
    *查询所有货物信息
    *
    * @param tableName
    * @param entryInfo
    * @param order
    * @return
    */
    @SelectProvider(type = SqlProvider.class, method = "selectAll")
    List<TCargo> queryAllCargo(@Param("tableName") String tableName, @Param("qryObj") TCargo qryCargo,
                               @Param("sortOrder") String order);

    @Delete("delete from t_Cargo where indx=#{index}")
    boolean deleteCustGoodsInfo(String index);



    @InsertProvider(type = SqlProvider.class, method = "insert")
    <T> int insert(@Param("tableName") String tableName,
                   @Param("insertObj") T param);

}


